﻿using M_Ingredient.API.Application.Command.IngredientCommand;
using M_Ingredient.Domain;
using M_Ingredient.Repository.Interface;
using M_Quality.Domain;
using MediatR;

namespace M_Ingredient.API.Application.CommandHandler.IngredientCommandHandler
{
    public class IngredientBackfillCommandHandler : IRequestHandler<IngredientBackfillCommand, Ingredient>
    {
        protected readonly IIngredientRepository ingredientRepository;

        public IngredientBackfillCommandHandler(IIngredientRepository ingredientRepository)
        {
            this.ingredientRepository = ingredientRepository;
        }

        public Task<Ingredient> Handle(IngredientBackfillCommand request, CancellationToken cancellationToken)
        {
            var id = request.IngredientId;
            var res = ingredientRepository.GetModelAsync(id);
            return res;
        }
    }
}
